﻿Imports Training.Common

Partial Public Class Users
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    ''' <summary>
    ''' search button click event
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        If Page.IsValid Then
            FullSearch()
        End If
    End Sub

    ''' <summary>
    ''' Search for user by email and redirec to edit page
    ''' </summary>
    ''' <remarks>OLD SEARCH BY EMAIL ONLY</remarks>
    Private Sub SearchRedirect()
        ' get user info by email address
        GetUserIDByEmail(Trim(tbUserSearch.Text))

        ' make sure there is data before redirecting
        If Not IsNothing(aUserID) And Not IsNothing(firstname) And Not IsNothing(lastname) Then
            Dim fName As String
            fName = firstname & " " & lastname
            Response.Redirect("EditGroupUser.aspx?uid=" & aUserID & "&unm=" & fName)
        Else
            ' couldn't find user with that email
            lblMsg.Text = "No user could be located with that email address"
        End If
    End Sub

    ''' <summary>
    ''' redirect for full Users Search
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub FullSearch()
        Response.Redirect("UserSearchResults.aspx?sch=" & Trim(tbUserSearch.Text))
    End Sub
End Class